import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store/index';
import ElementUI from 'element-ui';
import './assets/css/common/common.scss';
import './assets/css/icon-css/iconfont.css'; // 引入icon css
import 'element-ui/lib/theme-chalk/index.css'; // 默认主题，不引用字体图标不显示
import './assets/css/element-edit-style.scss'; // 修改element
import './assets/css/common/global.scss';
import 'animate.css';
import scroll from 'vue-seamless-scroll'
import moment from 'moment' //导入文件 
Vue.prototype.$moment = moment; //赋值使用
Vue.prototype.$imageServer="http://81.70.251.79:5800/"
// 全局注册组件
var echarts = require('echarts');
Vue.prototype.$echarts = echarts;


window.fontSize = Vue.prototype.fontSize = px =>Math.round((window.innerHeight / 1080) * px);

import './utils/rem';
// import api from './api/request'
// Vue.prototype.$api = api;
import ajax from './utils/request';
Vue.prototype.$axios = ajax;
Vue.config.productionTip = false;
Vue.use(ElementUI);
Vue.use(scroll);

Vue.directive("drag", {
  inserted: function (el) {
    el.onmouseover = function (e) {
      if (el === e.target) {
        this.style.cursor = "move";
      } else {
        this.style.cursor = "default";
      }
    };
    el.onmousedown = function (e) {
      if (el === e.target) {
        var disx = e.pageX - el.offsetLeft;
        var disy = e.pageY - el.offsetTop;
        document.onmousemove = function (e) {
          el.style.left = e.pageX - disx + "px";
          el.style.top = e.pageY - disy + "px";
        };
        document.onmouseup = function () {
          document.onmousemove = document.onmouseup = null;
        };
      }
    };
  }
});

export const vm  = new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app');